package day09.objectdemo.demo;

/**
 * 测试类
 * @since 09:57
 * @author wuguidong@cskaoyan.onaliyun.com
 */
public class Test {
    public static void main(String[] args) {
        /*for (int i = 0; i < 12; i++) {
            Student s = Student.getStudentInstance();
            System.out.println("第" + (i + 1) + "次创建对象,该对象是" + s);
        }*/

        for (int i = 0; i < 5; i++) {
            Student s = Student.getStudentInstance();
            System.out.println("第" + (i + 1) + "次创建对象,该对象是" + s.print());
        }

        for (int i = 0; i < 10; i++) {
            Student s = Student.getStudentInstance("张三", 18);
            if (s == null){
                System.out.println("null");
                return;
            }
            System.out.println("第" + (6 + i) + "次创建对象,该对象是" + s.print());
        }
    }
}
